package com.pz.cloud.framework.researchProj.callback;

import com.pz.cloud.framework.business.researchProj.cons.ProjectStepEnum;
import com.pz.cloud.framework.business.researchProj.entity.ResearchProject;
import com.pz.cloud.framework.business.researchProj.service.IResearchProjectService;
import com.pz.cloud.framework.business.workflow.model.BaseTaskCallback;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
public class ResearchProjectCallback extends BaseTaskCallback<ResearchProject, IResearchProjectService> {

    @Autowired
    private IResearchProjectService researchProjectService;

    @Override
    public void callback(ResearchProject obj) {
        if (processInfo.processEnd()) {
            obj.setBuildTime(new Date());
            obj.setProjectStep(ProjectStepEnum.BUILD.getCode());
            researchProjectService.updateById(obj);
        }
    }
}
